package com.smsc.headend.task.engine.service.task;

import com.smsc.headend.module.asset.dmo.ComConfigDMO;
import com.smsc.headend.module.asset.dmo.DLMSConfigDMO;
import com.smsc.headend.module.asset.dmo.MeterConfigDMO;
import com.smsc.headend.module.asset.dto.*;
import com.smsc.headend.module.asset.entity.ComEntity;
import com.smsc.headend.module.asset.entity.Meter;
import com.smsc.headend.module.data.dmo.DeviceSAPandKeys;
import com.smsc.headend.module.data.dto.AnsiSubDataItemDTO;
import com.smsc.headend.module.data.dto.DataItemDTO;
import com.smsc.headend.module.task.dto.AtomicTask;
import com.smsc.headend.module.task.dto.Task;
import com.smsc.headend.module.template.clock.entity.TemplateClockEntity;
import com.smsc.headend.module.template.dcu.entity.*;
import com.smsc.headend.task.engine.exception.UDISTaskExecutorException;
import com.smsc.headend.task.engine.po.PacketParseResult;
import gurux.dlms.GXDate;
import gurux.dlms.GXTime;

import java.util.Date;
import java.util.List;
import java.util.Map;

public interface TaskPacketService {
    PacketParseResult parsePacket(List<byte[]> results, Task task, DLMSConfigDMO dlmsConfigDMO);

    byte[] buildReadOneAttributePacket(DataItemDTO dataItemCosemList, DLMSConfigDMO dlmsConfigDMO, DeviceSAPandKeys deviceKeys) throws UDISTaskExecutorException;

    byte[] buildReadWithListPacket(List<DataItemDTO> dataItemCosemList, Meter meter, MeterConfigDMO meterConfigDMO);

    byte[] buildReadProfilePacket(List<DataItemDTO> dataItemCosemList, Meter meter, Date startDate, Date endDate, DLMSConfigDMO dlmsConfigDMO);

    byte[] writeSimpleDataPacket(List<DataItemDTO> dataItemCosemList, Meter meter, Object value, DLMSConfigDMO dlmsConfigDMO) throws UDISTaskExecutorException;

    byte[][] writeProfileCaptureObjects(List<DataItemDTO> dataItemCosemList, Meter meter, List<DataItemDTO> captureObjectLists, DLMSConfigDMO dlmsConfigDMO);

    byte[][] writeDCUMeterList(ComEntity termId, List<Meter> meters, List<DataItemDTO> dataItemCosemList, DLMSConfigDMO dlmsConfigDMO);

    byte[][] deleteDCUMeterList(ComEntity comEntity, List<String> serialNums, List<DataItemDTO> dataItemCosemList, ComConfigDMO dlmsConfigDMO);

    byte[] buildDCUScheduleRead(ComEntity comEntity, Meter meter, DataItemDTO dataItemDTO, DataItemDTO profileDataItemDTO, Date startDate, Date endDate, DLMSConfigDMO dlmsConfigDMO, DeviceSAPandKeys deviceKeys);

    byte[] imageTransferInitAction(DataItemDTO dataItem, String interfaceType, Boolean isShortName, Integer wPort, String identifier, Long imageSize);

    byte[] imageBlockTransferAction(DataItemDTO dataItem, String interfaceType, DLMSConfigDMO dlmsConfigDMO, Boolean isShortName, Integer wPort, byte[] fileImageBlock, int blockNumber);

    byte[] imageTransferVerifyAction(DataItemDTO dataItem, String interfaceType, Boolean isShortName, Integer wPort);

    byte[] imageTransferActivation(DataItemDTO dataItem, String interfaceType, Boolean isShortName, Integer wPort);

    byte[] setClockTimePacket(DataItemDTO dataItemDTO, DLMSConfigDMO dlmsConfigDMO, Long modelId, DeviceSAPandKeys deviceKeys, Date date);

    byte[] disconnectControlAction(DataItemDTO dataItem, String interfaceType, Boolean isShortName, DeviceSAPandKeys deviceKeys);

    byte[] upgradeSettings(Long modelId, DataItemDTO dataItem, AtomicTask atomicTask, Map<String, Object> params, String interfaceType, Boolean isShortName, Integer wPort);

    byte[][] setDCUDataCollTask(List<TemplateDcuAutoCollTask> dcuACollTasks, DataItemDTO dataItemDTO, DLMSConfigDMO dlmsConfigDMO);

    byte[] setDCUMeterTask(boolean isClearMeterTask, List<String> meterNos, List<DcuMeterTaskDto> dcuMeterTaskDtos, DataItemDTO dataItemDTO, DLMSConfigDMO dlmsConfigDMO);

    byte[] setDCUSimpleData(Object value, DataItemDTO dataItemDTO, DLMSConfigDMO dlmsConfigDMO) throws UDISTaskExecutorException;

    byte[] setDCUGPRSParamData(TemplateParamsDcuGprs templateParamsDcuGprs, DataItemDTO dataItemDTO, DLMSConfigDMO dlmsConfigDMO);

    byte[] setDCUEthernetParamData(TemplateParamsDcuEthernet templateParamsDcuEthernet, DataItemDTO dataItemDTO, DLMSConfigDMO dlmsConfigDMO);

    byte[] setDCUBasicParamData(TemplateParamsDcuBasic templateParamsDcuBasic, DataItemDTO dataItemDTO, DLMSConfigDMO dlmsConfigDMO);

    byte[] setDCUFtpParamData(FtpDataDto ftpDataDto, DataItemDTO dataItemDTO, DLMSConfigDMO dlmsConfigDMO);

    byte[] setActiveCalendarPacket(DataItemDTO dataItemDTO, Meter meter, DLMSConfigDMO dlmsConfigDMO, DeviceSAPandKeys deviceSAPandKeys, TouDataDTO touDataDTO) throws UDISTaskExecutorException;

    byte[] setSpecialDaysPacket(DataItemDTO dataItemDTO, Meter meter, DLMSConfigDMO dlmsConfigDMO, DeviceSAPandKeys deviceSAPandKeys, TouDataDTO touDataDTO) throws UDISTaskExecutorException;

    byte[] setFriendlyDaysPacket(DataItemDTO dataItemDTO, Meter meter, DLMSConfigDMO dlmsConfigDMO, DeviceSAPandKeys deviceSAPandKeys, TouDataDTO touDataDTO) throws UDISTaskExecutorException;

    byte[] setLimiterPacket(DataItemDTO dataItemDTO, Meter meter, DLMSConfigDMO dlmsConfigDMO, DeviceSAPandKeys deviceSAPandKeys, LoadLimitDataDto limitDataDto) throws UDISTaskExecutorException;

    byte[] setScheduleAction(DataItemDTO dataItemDTO, Meter meter, DLMSConfigDMO dlmsConfigDMO, DeviceSAPandKeys deviceSAPandKeys, List<GXDate> dateList, List<GXTime> timeList) throws UDISTaskExecutorException;

    byte[] setClockObjectPacket(DataItemDTO dataItemDTO, Meter meter, DLMSConfigDMO dlmsConfigDMO, DeviceSAPandKeys deviceSAPandKeys, TemplateClockEntity templateClockEntity) throws UDISTaskExecutorException;

    byte[] actionTokenDataPacket(List<DataItemDTO> dataItemCosemList, Meter meter, Object value, DLMSConfigDMO dlmsConfigDMO, DeviceSAPandKeys deviceKeys) throws UDISTaskExecutorException;

    byte[] keyTransferDataPacket(DataItemDTO dataItemDTO, KeyTransferDTO hlsKeys, DLMSConfigDMO dlmsConfigDMO, DeviceSAPandKeys deviceKeys) throws UDISTaskExecutorException;

    byte[] setDcuAutoConnect(TemplateParamsDcuAutoConnect autoConnect, DataItemDTO dataItemDTO, ComConfigDMO comConfigDMO);

    byte[] buildReadOneAttributePacketWithMfgSn(DataItemDTO dataItemDto, Meter meter, DLMSConfigDMO dlmsConfigDMO, DeviceSAPandKeys deviceKeys);

    byte[][] setLongArrayToData(DataItemDTO dataItemDTO, MeterConfigDMO comConfigDMO, List<Long> values);

    byte[] profileCaptureAction(DataItemDTO dataItem, String interfaceType, Object data, Boolean isShortName, DeviceSAPandKeys deviceKeys);

    byte[][] getProcedurePacket(DataItemDTO dataItemDTO, Meter meter);

    byte[][] writeDisplayCodeList(List<Integer> codeList, List<DataItemDTO> dataItemCosemList, DLMSConfigDMO dlmsConfigDMO);

    byte[] ansiWriteFullTable(int tableId, byte[] data, Long meterId);
}
